# Contributor: Fabricio Silva <hi@fabricio.dev>
# Maintainer: Fabricio Silva <hi@fabricio.dev>
pkgname=yarn-berry
pkgver=4.5.1
pkgrel=0
pkgdesc="Fast, reliable, and secure dependency management for Node.js - Active development version"
url="https://yarnpkg.com/"
license="BSD-2-Clause"
arch="noarch"
depends="!yarn nodejs" # not backward compatible with yarn classic (v1)
source="$pkgname-$pkgver.tgz::https://registry.npmjs.org/@yarnpkg/cli-dist/-/cli-dist-$pkgver.tgz"
builddir="$srcdir/package"
replaces="yarn"

check() {
	./bin/yarn.js --version
	./bin/yarn.js --help
}

package() {
	local destdir="usr/share/node_modules/@yarnpkg/cli-dist"

	mkdir -p "$pkgdir"/$destdir/bin
	install -Dm0644 package.json -t "$pkgdir"/$destdir
	install -Dm0755 bin/yarn.js -t "$pkgdir"/$destdir/bin

	mkdir -p "$pkgdir"/usr/bin
	ln -s ../share/node_modules/@yarnpkg/cli-dist/bin/yarn.js "$pkgdir"/usr/bin/yarn
	ln -s yarn "$pkgdir"/usr/bin/yarnpkg
}

sha512sums="
75ff436725923db9523b091aacaef6f4407b48e850f6642f8c6298d588a20008f70c18abf35172c5e0c625b4e3f235598c4e784d7ca94ee298ab274047290c4e  yarn-berry-4.5.1.tgz
"
